package com.design.pattern.structure.conposite.safe;

import java.util.ArrayList;
import java.util.List;

public class Composite extends Component{
    private List<Component> composites;
    public Composite(String name) {
        super(name);
        this.composites = new ArrayList<Component>();
    }

    public boolean addChild(Component component) {
        return this.composites.add( component);
    }

    public boolean removeChild(Component component) {
        return this.composites.remove(component);
    }

    public Component getChild(int index) {
        return this.composites.get(index);
    }

    @Override
    public String operation() {
        return null;
    }
}
